/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cse.p2p.hash;

import java.io.File;
import java.util.Map;
import com.cse.p2p.parser.*;
/**
 *
 * @author TuyetNgan
 */
public interface HashInterface {
    /**
     * Use java.security.MessageDigest encode SHA-1
     * 
     * @param text : content of file
     * @return SHA-1 message
     */
    String SHA1(String text);
    /**
     * Convert from an array of byte into hex
     * 
     * @param data : an array of byte 
     * @return Hex string after convert
     */
    String convertToHex(byte[] data);
    
    /**
     * Get HASH_MAP to import into DicFile
     * 
     * @param file :  File Object
     * @param pieceSize
     * @param pieceNumber : amount of pieces
     * @return Map of Hash pieces
     */
    Map getHashMap(File file,int pieceSize, int pieceNumber);
    
    /**
     * Compare 2 hash code to check
     * 
     * @param hash1 
     * @param hash2
     * @return TRUE if hash1 = hash 2, FALSE if otherwise
     */
    Boolean compareHash(String hash1, String hash2);
    
    /**
     * Hash content of one piece
     * 
     * @param text : piece content 
     * @return hash code of piece
     */
    String getHash(String text);
}
